package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

public class ReflectDemo10 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        Class cls =Class.forName("reflect.Person");
        Method method= cls.getDeclaredMethod("SayHello");
        if (method.isAnnotationPresent(AutoRunMethod.class)){
            System.out.println("被标注了");
            AutoRunMethod arm = method.getAnnotation(AutoRunMethod.class);
            int value = arm.value();
            System.out.println("注解参数值是" + value);
        }else {
            System.out.println("没有被标注");
        }
    }
}
